export class WaveManager {
  constructor(script = [], spawnFn = () => {}) { this.t = 0; this.script = script; this.spawn = spawnFn; this._triggered = new Set(); }
  update(dt) {
    this.t += dt;
    for (let i = 0; i < this.script.length; i++) {
      const e = this.script[i];
      if (!this._triggered.has(i) && e.t <= this.t) {
        this._triggered.add(i);
        const count = e.count || 1;
        for (let k = 0; k < count; k++) this.spawn(e.lane, e.zombieType);
      }
    }
  }
  isComplete() { return this._triggered.size === this.script.length; }
  // 新增：重置波次管理状态
  reset() { this.t = 0; this._triggered.clear(); }
}